using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class admin_BaseUserControl : System.Web.UI.UserControl
{
    #region fields
    string activeAccording = "";
    #endregion

    #region properties
    public string CurrentID
    {
        get { return Session["curID"].ToString(); }
        set { Session["curID"] = value; }
    }

    /// <summary>
    /// Get or set name of according bar will be active
    /// </summary>
    public string ActiveAccording
    {
        get { return activeAccording; }
        set { activeAccording = value; }
    }
    #endregion


    protected void Page_Load(object sender, EventArgs e)
    {

    }

    #region methods
    /// <summary>
    /// Show message in administration page
    /// </summary>
    /// <param name="message"></param>
    protected void ShowMessage(string message)
    {
        Label lb = ((Label)this.Parent.Parent.FindControl("lblMessage"));
        if (lb != null )
        {
            if (message != "")
            {
                lb.Visible = true;
                lb.Text = message;
                lb.CssClass = "message_box";
                message = "";
            }
            else
            {
                lb.Visible = false;
            }
        }
    }
    public bool IsPersolnel
    {
        get
        {
            User user = Session["user"] as User;
            if (user == null) return false;
            if (user.Role > 0 && user.Role <= 3) return true;
            return false;
        }
    }
    public int GetCurrentUserRole()
    {
        User user = Session["user"] as User;
        if (user == null) return 10;
        return user.Role;
    }
    #endregion

}
